package key;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * Servlet implementation class Mweek
 */
@WebServlet("/Mmax")
public class Mmax extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	Database db = new Database();
    /**
     * @see HttpServlet#HttpServlet()
     */
    public Mmax() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String maxTime = request.getParameter("maxTime");
		int max = Integer.parseInt(maxTime);
		db.setMax(max);
		
		/* 生成页面 */
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();
		response.setCharacterEncoding("utf-8");
		out.println("<html>\n<head>\n<title>提示信息</title>\n</head>\n<body>");
		out.println("<script type='text/javascript'>\nconfirm('设置成功')");
		out.println("window.location.href='master/index.jsp';\n</script>");
		out.println("</body>\n</html>");
		
//		response.sendRedirect("master/index.jsp");
//		@SuppressWarnings("unused")
//		Frame fr = new Frame("设置成功");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
